<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui"
      xmlns:c="http://java.sun.com/jsp/jstl/core">
 <!-- Menu: Calendario, Materia, Mensajes, Recursos, Configuracion, Administracion, Salir-->
    <ui:composition>
        <h:form id="menuForm" rendered="#{loginBean.loggedIn}">
            
            <p:menubar rendered="#{loginBean.loggedIn}">
                <c:forEach var="item_main_menu" items="#{menuBean.mainMenu}">
                    <p:menuitem value="#{item_main_menu.titulo}" url="#{item_main_menu.url}" icon="#{item_main_menu.icono}"/>
                </c:forEach>
                <c:set var="admin_menu" value="#{menuBean.adminMenu}"/>
                <p:submenu label="#{admin_menu.titulo}" icon="#{admin_menu.icono}" rendered="#{loginBean.isAdmin}">
                    <c:forEach var="item_admin_menu" items="#{menuBean.adminSubMenu}" rendered="#{loginBean.isAdmin}">
                        <p:menuitem value="#{item_admin_menu.titulo}" url="#{item_admin_menu.url}" icon="#{item_admin_menu.icono}" rendered="#{loginBean.isAdmin}"  style="width: 180px;"/>
                    </c:forEach>
                </p:submenu>               
                <p:menuitem value="Cerrar Sesión" icon="ui-icon-power" action="#{loginBean.logout}" ajax="false"/>
            </p:menubar>
        </h:form>
    </ui:composition>
</html>